package com.example.app.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * @author wangzhuangzhuang
 * @DESC:
 * @date 2022-02-09 14:49
 */
@RestController
public class HelloController {

	@RequestMapping("/hello")
	public String hello(HttpServletRequest request, HttpSession session){
		// 操作attribute
		request.setAttribute("a", "a");
		request.setAttribute("a", "b");
		request.getAttribute("a");
		request.removeAttribute("a");

		// 操作session
		session.setAttribute("a", "a");
		session.getAttribute("a");
		session.invalidate();

		return "hello world";
	}
}